import { backstageUrl, baseUrl } from "./config.js";
import Axios from "axios";

Axios.defaults.baseURL = baseUrl;

//获取学校所属市id
export let getSchoolParent = (id) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getSchoolParent", {
            params: {
                id: id
            }
        })
    );
}


//得到教育局底下所属学校类型
export let getSchoolLevelByEduIdApi = (departmentId, allType) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getSchoolLevelByEduId", {
            params: {
                departmentId: departmentId,
                allType: allType
            }
        })
    );
}


//得到中心学校底下学校类型
export let getSchoolLevelByCenterEduIdApi = (departmentId) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getSchoolLevelByCenterEduId", {
            params: {
                departmentId: departmentId
            }
        })
    );
}

//查询教育局日常统计表中的学校数据
export let getSchoolBySchooLevelApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getSchoolBySchooLevel", {
            params: {
                departmentId: departmentId,
                schoolLevel: schoolLevel, 
                startTime: startTime,
                endTime: endTime,
            }
        })
    );
}

//查询教育局表中学校巡检完成率
export let getAverageInspectClassRatesApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getAverageInspectClassRates", {
            params: {
                departmentId: departmentId,
                schoolLevel: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            }
        })
    );
}


//查询学校巡检综合排名
export let getSchoolInspectCompositeRankApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getSchoolInspectCompositeRank", {
            params: {
                departmentId: departmentId,
                schoolLevel: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            }
        })
    );
}

//巡检次数排名
export let getSchoolBySchooLevel2Api = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getSchoolBySchooLevel2", {
            params: {
                departmentId: departmentId,
                schoolLevel: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            }
        })
    );
}

//巡检完成率排名
export let getAverageInspectClassRates2Api = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getAverageInspectClassRates2", {
            params: {
                departmentId: departmentId,
                schoolLevel: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            }
        })
    );
}



//巡检综合积分排名柱状图
export let getSchoolInspectCompositeRank2Api = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getSchoolInspectCompositeRank2", {
            params: {
                departmentId: departmentId,
                schoolLevel: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            }
        })
    );
}

//巡更次数排名
export let getEduPatrolNumRankApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduPatrolNumRank", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

export let getEduPatrolNumRankApi2 = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduPatrolNumRank2", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

//巡更完成率排名
export let getEduPatrolRatesRankApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduPatrolRatesRank", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

export let getEduPatrolRatesRankApi2 = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduPatrolRatesRank2", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

//巡更积分排名
export let getEduPatrolPointsRankApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduPatrolPointsRank", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

export let getEduPatrolPointsRankApi2 = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduPatrolPointsRank2", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

//隐患次数排名
export let getEduDangerNumRankApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduDangerNumRank", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

export let getEduDangerNumRankApi2 = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduDangerNumRank2", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

export let getEduDangerCategoryApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduDangerCategory", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

export let getEduDangerDealRateApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduDangerDealRate", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}

export let getEduDangerDealRateApi2 = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getEduDangerDealRate2", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
            
        })
    );
}


//综合积分排名
export let getComprehensivePointsRankApi = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getComprehensivePointsRank", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

export let getComprehensivePointsRankApi2 = (departmentId, schoolLevel, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getComprehensivePointsRank2", {
                educationId: departmentId,
                schooltype: schoolLevel,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// ----------- 区县统计 -----------------

// 巡检次数排名
export let getCountyInspectNumRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyInspectNumRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡检完成率排名
export let getCountyInspectRatesRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyInspectRatesRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡检积分排名
export let getCountyInspectPointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyInspectPointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡更次数排名
export let getCountyPatrolNumRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyPatrolNumRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡更完成率排名
export let getCountyPatrolRatesRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyPatrolRatesRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡更积分排名
export let getCountyPatrolPointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyPatrolPointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 隐患次数排名
export let getCountyDangerNumRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyDangerNumRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 隐患积分排名
export let getCountyDangerDealPointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyDangerDealPointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}


// 综合积分排名
export let getCountyComprehensivePointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getCountyComprehensivePointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}


// ------------- 学校统计 --------------
// 巡检次数排名
export let getSchoolInspectNumRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolInspectNumRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡检完成率排名
export let getSchoolInspectRatesRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolInspectRatesRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡检积分排名
export let getSchoolInspectPointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolInspectPointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡更次数排名
export let getSchoolPatrolNumRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolPatrolNumRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡更完成率排名
export let getSchoolPatrolRatesRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolPatrolRatesRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 巡更积分排名
export let getSchoolPatrolPointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolPatrolPointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 隐患次数排名
export let getSchoolDangerNumRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolDangerNumRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}

// 隐患积分排名
export let getSchoolDangerDealPointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolDangerDealPointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}


// 综合积分排名
export let getSchoolComprehensivePointsRankApi = (educationId, schooltype, startTime, endTime) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getSchoolComprehensivePointsRank", {
                educationId: educationId,
                schooltype: schooltype,
                startTime: startTime,
                endTime: endTime,
        })
    );
}


export let getXunchaPlanApi = (departmentId) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getXunchaPlan", {
           
                departmentId: departmentId,
            
        })
    );
}
export let XunchaRecordSearchApi = (departmentId, realname, schoolname, type, status, startTime, endTime, theme, normal) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/xunchaRecordSearch", {
                departmentId: departmentId,
                realname: realname,
                schoolname:schoolname,
                type:type,
                status:status,
                startTime:startTime,
                endTime:endTime,
                theme:theme,
                normal:normal
        })
    );
}
export let DailyRecordSearchApi = (departmentId, realname, schoolname, status, startTime, endTime, normal) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/dailyRecordSearch", {
                departmentId: departmentId,
                realname: realname,
                schoolname:schoolname,
                status:status,
                startTime:startTime,
                endTime:endTime,
                normal: normal
        })
    );
}
export let getDingshiPlanApi = (id) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getDingshiPlan", {
           
                id: id,
            
        })
    );
}
export let deleteXunchaPlanApi = (id, type) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/deleteXunchaPlan", {
            
                id: id,
                type: type,
            
        })
    );
    
}
export let updateXunchaPlanApi = (id, type, values, cycle) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/updateXunchaPlan", {
            
                id: id,
                type: type,
                theme:values.theme,
                startTime: values.starttime,
                endTime:values.endtime,
                cycle:cycle,
                plantimes:values.plantimes
            
        })
    );
    
}
export let updateDingshiPlanApi = (id, values) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/updateDingshiPlan", {
                id: id,
                theme:values.theme
               
            
        })
    );
    
}
export let getDepartmentParentApi = (departmentId) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getDepartmentParent", {
            params: {
                departmentId: departmentId,
            }
        })
    );
}
export let getAllChildDepartmentApi = (departmentId) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/getAllChildDepartment", {
            
                id: departmentId,
            
        })
    );
}
export let addXunchaPlanForDepartmentApi = (record, values) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/addXunchaPlanForDepartment", {
            
            cycle:record.cycle,
            endTime:record.endTime,
            id:record.id,
            isdone:record.isdone,
            isuse:record.isuse,
            realname:record.realname,
            startTime:record.startTime,
            theme:record.theme,
            type:record.type,
            userId:record.userId,
               departmentId:values.department,
               plantimes:record.plantimes
            
        })
    );
}
export let IsUseForDepartment = (record) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/IsUseForDepartment", {
            
                id: record.id,
                type:record.type
            
        })
    );
}
export let addXunchaPlanApi = (userId, departmentId, values) => {
    return (
        Axios.post(backstageUrl + "edudailystatistics/addXunchaPlan", {
            
            userId:userId,
            departmentId:departmentId,
            cycle:values.DingqiType,
            endTime:values.endtime,
            startTime:values.starttime,
            theme:values.theme,
            type:values.themeType,
            plantimes:values.plantimes
           
            
        })
    );
}
export let getXunchaContentApi = (superviseId) => {
    return (
        Axios.get(backstageUrl + "edudailystatistics/getXunchaContent", {
            params: {
                superviseId: superviseId
            }
        })
    );
}
export let addContentItemApi = (superviseId, items)=>{
    return(
        Axios.post(backstageUrl+"edudailystatistics/addContentItem", {
            superviseId:superviseId,
            contentIds:items
        })
    );
}
